import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.file.*;

public class FilesExample {
    public static void main(String[] args) {
        demo();
    }

    private static void demo(){
        try{
            Path path = Paths.get("./nio/src/8.txt");
            String str = "今天天气不错哦\n";
            Files.write(path,str.getBytes(),StandardOpenOption.CREATE, StandardOpenOption.APPEND);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
